using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Drawing;
using System;
namespace BlogControl
{
    public partial class Blog
    {
        public delegate void _pageIndexChanged(PageIndexChangedArguments args);
        [Description("Fires after the page index has been changed")]
        public event _pageIndexChanged PageIndexChanged;
        internal void TriggerPageIndexChanged(PageIndexChangedArguments args)
        {
            if (PageIndexChanged!=null)
                PageIndexChanged.Invoke(args);
        }

        public delegate void _commentAdded(CommentArguments args);
        [Description("Fires after a new comment has been added")]
        public event _commentAdded CommentAdded;
        internal void TriggerCommentAdded(CommentArguments args)
        {
            if (CommentAdded!=null)
                CommentAdded.Invoke(args);
        }

        public delegate void _postAdded(PostArguments args);
        [Description("Fires after a new post has been added")]
        public event _postAdded PostAdded;
        internal void TriggerPostAdded(PostArguments args)
        {
            if (PostAdded!=null)
                PostAdded.Invoke(args);
        }

       
        public delegate void PostViewed(PostViewedArguments args);
        /// <summary>
        /// Triggers when a user clicks on a post title for viewing
        /// the post in a different page
        /// </summary>
        [Description("Fires after a user click on a post title for viewing the post in a different page")]
        public event PostViewed OnPostViewed;

        /// <summary>
        /// trigger the OnPostViewed event
        /// </summary>
        /// <param name="args"></param>
        internal void TriggerPostViewed(PostViewedArguments args)
        {
            if (OnPostViewed!=null)
                OnPostViewed.Invoke(args);
        }
    }
    public class PageIndexChangedArguments : EventArgs
    {
        public PageIndexChangedArguments(int newPageIndex,int oldPageIndex)
        {
            this._newPageIndex = newPageIndex;
            this._oldPageIndex = oldPageIndex;
        }
        private int _newPageIndex;

        public int NewPageIndex
        {
            get { return _newPageIndex; }
        }
        private int _oldPageIndex;

        public int OldPageIndex
        {
            get { return _oldPageIndex; }
        }
    }
    public class PostViewedArguments : EventArgs
    {
        public PostViewedArguments(string postName, string postFileName)
        {
            this._postName = postName;
            this._postFileName = PostFileName;
        }
        private string _postFileName;

        public string PostFileName
        {
            get { return _postFileName; }
        }
        private string _postName;

        public string PostName
        {
            get { return _postName; }
        }
    }
    public class PostArguments : EventArgs
    {
        public PostArguments() { }
        public PostArguments(string subject, string writer, string body, string postFileName)
        {
            this._subject = subject;
            this._writer = writer;
            this._body = body;
            this._postFileName = postFileName;
        }
        private string _subject;

        public string Subject
        {
            get { return _subject; }
        }
        private string _writer;

        public string Writer
        {
            get { return _writer; }
        }
        private string _body;

        public string Body
        {
            get { return _body; }
        }
        private string _postFileName;

        public string PostFileName
        {
            get { return _postFileName; }
        }
       
    }
    public class CommentArguments : EventArgs
    {
        public CommentArguments() { }
        public CommentArguments(string subject, string writer, string body, string postFileName, string postName)
        {
            this._subject = subject;
            this._writer = writer;
            this._body = body;
            this._postFileName = postFileName;
            this._postName = postName;
        }
        private string _subject;

        public string Subject
        {
            get { return _subject; }
        }
        private string _writer;

        public string Writer
        {
            get { return _writer; }
        }
        private string _body;

        public string Body
        {
            get { return _body; }
        }
        private string _postFileName;

        public string PostFileName
        {
            get { return _postFileName; }
        }
        private string _postName;

        public string PostName
        {
            get { return _postName; }
        }
    }
}